home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Macintosh Debugging / Blat / Blat Read Me next >
Encoding:
Text File  |  1992-10-25  |  6.5 KB  |  122 lines  |  [TEXT/MPS ]

  1.  
  2.     -----------Blat  dcmd------------
  3.     
  4.         Bo3b Johnson
  5.         MS 37-RR
  6.         
  7.         Version 3.        There was no prior general release.
  8.         
  9.         Version 5.  11/2/91    Fixed numerous bugs, and I'm sure there are more.  
  10.             Works with Macsbug Log now, and switching video pages.  
  11.             Fixes for VM not being installed, so that error checking works properly on IIx.
  12.             Tested on IIx and IIfx.
  13.             Seems to be incompatible with DAL.
  14.         
  15.     Introduction:
  16.         Blat is a dcmd that uses the MMU in order to catch references to memory locations
  17.         0 through 255.   That is, it will stop any program from reading or writing to the
  18.         memory that starts at zero, and is 256 bytes long.  That hunk of memory is reserved
  19.         for Motorola, and is used as the exception vectors for the CPU.   There is no data
  20.         down there, and cannot be, since it is used directly by the CPU.  This tool is then to
  21.         catch any runtime references to those locations and to stop in the debugger when
  22.         they are seen.  Notably this includes memory location 0 itself, which has been noted
  23.         to be an evil location in the past.  Think of Blat as a Super Gonzo Mr. Bus Error.
  24.             
  25.     Compatibility:
  26.         I've run it successfully on IIfx, IIx, SE/30, IIcx.
  27.         
  28.         It is not compatible with IIsi, IIci, LC or any computers using that ROM. 
  29.         It is not compatible with 040 class machines.
  30.         You have to have an MMU in order to use it.
  31.         You cannot use VM with Blat.
  32.         It is not compatible with TMon Pro.
  33.         Doesn't seem to be compatible with DAL (on IIx).
  34.         
  35.     Installing:
  36.         Copy the dcmd into your debugger prefs file and reboot.
  37.         
  38.         Notably, Blat will change the VBR register and install its own MMU tables when
  39.         it is installed, even if it isn't turned on.  This adds uncertainty to the machine,
  40.         so it is probably best to only have it installed when you are actively using it.
  41.         Typically when Blat screws up, the computer is wedged in a big way.  In addition,
  42.         it will slow your machine, since the tables are smaller, and bus errors are being
  43.         handled.  It is occasionally visibly slower, but probably around 10% overall.
  44.     
  45.     Use:
  46.         The Blat command line is:
  47.         Blat   Off | Writes | Both | Dump | Ignore $xxx ... | IP | IL | Learn | Auto | Status
  48.  
  49.         'Blat Writes' will turn on memory protection for writes to 0..255, and will stop 
  50.         whenever any code changes that memory.  Blat will automatically give you an
  51.         IP around the offending code so you can inspect it.  Realize that you have stopped
  52.         in Blat, and not in the offending code, so the registers and the stack are not correct
  53.         for the code that is disassembled.  
  54.         
  55.         'Blat Off' will turn the memory protection off, so that no errors are reported.  As
  56.         an implementation detail, the MMU is still active and catching writes to that
  57.         page, it just isn't being reported.  I do this so that I can keep the VBR based copy
  58.         of the vectors up to date.  
  59.         
  60.         'Blat Both' will catch reads and writes both.  I think this is cool, and I hope you do
  61.         too, since it was brought to you at great expense.  Whenever any code touches that
  62.         page, it will be busted, and displayed in a similar way.  While testing it I've seen a
  63.         lot of code that fools around down there, that has no business doing so.  You will
  64.         see this as soon as you try to use a menu with Both turned on.  Any reason why 
  65.         the MDEF needs to read memory location 4?
  66.         
  67.         As you use Blat, you will find that it catches everything, including legitimate
  68.         system code that installs a temporary bus error handler.  Those bus errors happen,
  69.         and are caught by the system.  Writing to memory location 8 is the most likely
  70.         candidate in the system.  Nearly all are legitimate, but I don't special case them
  71.         so they can be seen.  This is obnoxious though, since you cannot make any
  72.         progress with Blat firing every few microseconds.  The rest of the features are
  73.         to deal with this problem.  
  74.         
  75.         'Blat Ignore $40803322' will ignore any bus errors that originate when the PC is
  76.         at that address.  You can ignore a specific address, or a set of addresses.  They are
  77.         added to a an internal Blat table and any references are no longer reported from
  78.         that address.  There is a maximum of 50 addresses that Blat will ignore.  If you
  79.         want more, that's why I'm giving you the source code.
  80.         
  81.         'Blat Dump' will give you a list of all of the addresses that Blat is ignoring.  These
  82.         are not saved over boot, so you have to build a new table each time.
  83.         
  84.         'Blat Learn' helps to build a new table.  If Blat is turned on, then it will
  85.         automatically ignore the address for each error as it happens.  This essentially lets
  86.         you see the error once, then it will be ignored from that point on.  Blat will tell you
  87.         that it is learning the address, to let you know that you won't be hassled with that
  88.         particular address from that point on.
  89.         
  90.         'Blat Auto' is an even handier version of automatic learning.  It will presume that
  91.         all bus errors it sees are legitimate, and will put them in the ignore table, and not
  92.         display them either.  They are written to the Macsbug screen, so you can see them,
  93.         but they won't stop.  Once you understand how it works and examine all the
  94.         bus errors that are displayed, this is the easiest way to fill the ignore buffer with
  95.         the legitimate addresses.  Unfortunately, some relocatable system code has bugs,
  96.         so they will move around and cause a few false alarms.  The CDEF is this way too.
  97.         
  98.         'Blat IP' or 'Blat IL' will change the form of automatic disassembly that Blat shows
  99.         for each error.  Each chooses the command that Blat issues to Macsbug.
  100.         
  101.         'Blat Status' will show you the state of the various flags that these options control,
  102.         so you can see the exact setup.   Learn and Auto are mutually exclusive for example,
  103.         and neither of those actually turn Blat on.
  104.         
  105.     Feedback:
  106.         Tell me what you think.  Call, QuickMail, or real Mail at 37-RR.  I am very curious
  107.         to know if this is useful or not.  If it helps find some bugs it serves its purpose.  If
  108.         the incompatibility problems make it useless for you, I would be interested to know
  109.         that as well.  Given the difficulty of writing code of this form, we have judged it to
  110.         not be worth the time to make it work in every situation.
  111.         
  112.         I've included the source in case it is helpful.  If you run into a situation that seems
  113.         to require changing the MMU tables or the bus error handler, you should contact
  114.         me instead of doing the work yourself.  The reason is simple: the only indication 
  115.         you get when something goes wrong is the machine is hung.  This makes it fairly
  116.         hard to debug, and I already have done so.  The source includes some of those
  117.         situations as comments.
  118.  
  119.             Bo3b.        
  120.         
  121.         
  122.